#Twisted Shootout
#Copyright (C) 2007  Han Dao
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program.  If not, see <http://www.gnu.org/licenses/>.

#You can contact the author at wikipediankiba@gmail.com
import pygame
import data
import item

class ItemTracker:
	def __init__(self,engine):
		self.engine = engine
		self.items = []
		self.data = data.read
		self.sprites = pygame.sprite.RenderPlain()
	def datacompute(self):
		rows = 0
		columns = 0
		for d in self.engine.obj[2]:
			a = columns * 80 + self.engine.position.move
			b = rows * 60 + self.engine.position.height
			self.x = a
			self.y = b
			if d == 2:
				name = "cache"
			elif d == 1:
				name = "medickit"
			else:
				name = True
			if name != True:      
				image = self.data.load(name,True)
				self.items.append(item.Item(image,d))
				self.items[-1].sets(self.x,self.y+50)
				self.sprites.add(self.items[-1])
			columns = columns + 1
			if columns == 30:
				rows = rows + 1
				columns = 0
			if rows == 30:
				return